/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package UMASchema15.impl;

import UMASchema15.CustomCategory;
import UMASchema15.UMASchema15Package;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Custom Category</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link UMASchema15.impl.CustomCategoryImpl#getGroup2 <em>Group2</em>}</li>
 *   <li>{@link UMASchema15.impl.CustomCategoryImpl#getCategorizedElement <em>Categorized Element</em>}</li>
 *   <li>{@link UMASchema15.impl.CustomCategoryImpl#getSubCategory <em>Sub Category</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class CustomCategoryImpl extends ContentCategoryImpl implements CustomCategory {
	/**
	 * The cached value of the '{@link #getGroup2() <em>Group2</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGroup2()
	 * @generated
	 * @ordered
	 */
	protected FeatureMap group2;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CustomCategoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return UMASchema15Package.Literals.CUSTOM_CATEGORY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureMap getGroup2() {
		if (group2 == null) {
			group2 = new BasicFeatureMap(this, UMASchema15Package.CUSTOM_CATEGORY__GROUP2);
		}
		return group2;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getCategorizedElement() {
		return getGroup2().list(UMASchema15Package.Literals.CUSTOM_CATEGORY__CATEGORIZED_ELEMENT);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<String> getSubCategory() {
		return getGroup2().list(UMASchema15Package.Literals.CUSTOM_CATEGORY__SUB_CATEGORY);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case UMASchema15Package.CUSTOM_CATEGORY__GROUP2:
				return ((InternalEList<?>)getGroup2()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case UMASchema15Package.CUSTOM_CATEGORY__GROUP2:
				if (coreType) return getGroup2();
				return ((FeatureMap.Internal)getGroup2()).getWrapper();
			case UMASchema15Package.CUSTOM_CATEGORY__CATEGORIZED_ELEMENT:
				return getCategorizedElement();
			case UMASchema15Package.CUSTOM_CATEGORY__SUB_CATEGORY:
				return getSubCategory();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case UMASchema15Package.CUSTOM_CATEGORY__GROUP2:
				((FeatureMap.Internal)getGroup2()).set(newValue);
				return;
			case UMASchema15Package.CUSTOM_CATEGORY__CATEGORIZED_ELEMENT:
				getCategorizedElement().clear();
				getCategorizedElement().addAll((Collection<? extends String>)newValue);
				return;
			case UMASchema15Package.CUSTOM_CATEGORY__SUB_CATEGORY:
				getSubCategory().clear();
				getSubCategory().addAll((Collection<? extends String>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case UMASchema15Package.CUSTOM_CATEGORY__GROUP2:
				getGroup2().clear();
				return;
			case UMASchema15Package.CUSTOM_CATEGORY__CATEGORIZED_ELEMENT:
				getCategorizedElement().clear();
				return;
			case UMASchema15Package.CUSTOM_CATEGORY__SUB_CATEGORY:
				getSubCategory().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case UMASchema15Package.CUSTOM_CATEGORY__GROUP2:
				return group2 != null && !group2.isEmpty();
			case UMASchema15Package.CUSTOM_CATEGORY__CATEGORIZED_ELEMENT:
				return !getCategorizedElement().isEmpty();
			case UMASchema15Package.CUSTOM_CATEGORY__SUB_CATEGORY:
				return !getSubCategory().isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (group2: ");
		result.append(group2);
		result.append(')');
		return result.toString();
	}

} //CustomCategoryImpl
